package org.hhchat.leetcode.twoPoints;

public class code167_easy {

    static class Solution {
        public int[] twoSum(int[] numbers, int target) {
            int[] result = new int[2];
            int p = 0, q = numbers.length - 1;
            while(p<q){
                if(numbers[p]+numbers[q]>target){
                    q--;
                }else if(numbers[p]+numbers[q]<target){
                    p++;
                }else{
                    result[0]= p+1;
                    result[1] = q+1;
                    return result;
                }
            }
            return result;
        }
    }

    public static void main(String[] args){

    }
}
